from django.template import loader,RequestContext,Context

def render_template(self,name=None,context={},request=None):
    if name:
        template = self.get_template(name)
        if request:
            return template.render(RequestContext(request,context))
        else:
            return template.render(Context(context))
    return u''

def render_template_source(self,source=None,context={},request=None):
    if source:
        template = loader.get_template_from_string(source)
        if request:
            return template.render(RequestContext(request,context))
        else:
            return template.render(Context(context))
    return u''

